package Chapter03;
//for循环计算8+88+888.。。前10项之和
public class Question5 {


   public static void main(String[] args) {
        int m = 8;
        long total = Sumnum(m);
        System.out.println("前10项和为："+total);//1286608608
    }
    private static long Sumnum(int num) {
        long total= 0;
        long item = 0;
        for (int i = 1; i <= 10; i++) {
            item = item * 10 + num;
            total=item+total;
            System.out.println(total);
        }
        return total;
    }




   }
